﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MS.Data.API.Read.Command.RoleInfo;
using MS.Data.Domain;
using MS.Data.ErrorCode;

namespace MS.Data.API.Read.Controllers
{
    /// <summary>
    /// API控制器-写 角色
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class MangRoleController : ControllerBase
    {
        IMediator mediator;

        public MangRoleController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 角色列表
        /// </summary>
        /// <param name="role"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<APIResult<APIPing<Role>>> GetRoleList([FromQuery] GetRoleCommand role)
        {
            return mediator.Send(role);
        }
    }
}
